<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>结账页面</title>
    <link rel="stylesheet" href="<%=basePath %>css/common_new.min.css">
    <link rel="stylesheet" href="<%=basePath %>static/css/owl.carousel.min.css">
    
    <link rel="stylesheet" href="<%=basePath %>css/zupin06.css">
    <script src="<%=basePath %>static/js/jquery.min.js"></script>
    
    <script type="text/javascript" src="<%=basePath%>static/layer/2.4/layer.js"></script>
    <link rel="stylesheet" href="<%=basePath %>static/layer/2.4/skin/layer.css">
    
    <!-- 顶部登录 -->
<script rel="script" src="<%=basePath%>js/vue.min.js"></script>
<link rel="stylesheet"
	href="//at.alicdn.com/t/font_699355_5fafq7zsd2fq1tt9.css">
<link rel="stylesheet" href="<%=basePath%>css/index.css">

    <!-- <script>
        var timeCounter = (function () {
            var int;
            var total = 3600;
            return function (elemID) {
                obj = document.getElementById(elemID);
                var s = (total % 60) < 10 ? ('0' + total % 60) : total % 60;
                var h = total / 3600 < 10 ? ('0' + parseInt(total / 3600)) : parseInt(total / 3600);
                var m = (total - h * 3600) / 60 < 10 ? ('0' + parseInt((total - h * 3600) / 60)) : parseInt((total - h * 3600) / 60);
                obj.innerHTML = h + ' : ' + m + ' : ' + s;
                total--;
                int = setTimeout("timeCounter('" + elemID + "')", 1000);
                if (total < 0) clearTimeout(int);
            }
        })()
    </script> -->
</head>

<body onLoad="timeCounter('timeCounter')">
    <!-- 顶部导航栏 -->
    <section>
        <div id="header">
	   		<!-- 顶部登录 -->
			<jsp:include page="yeah-top.jsp" />
		</div>
    </section>

    <section class="row">
    	<form action="moneyCheck" method="post" onsubmit="return stocknumcheck('${oid }')&&yanz()">
	        <h1>选择付款方式</h1>
	        	<input type="hidden" value="${oid }" name="oid"/>
	        <div class="f">
	            <p class="f1">订单号：${oid }</p>
	            <p class="f2">实付：
	                <span>￥<fmt:formatNumber value="${payments }" pattern="#.##" minFractionDigits="2"/></span>
	            </p>
	        </div>
	        <br>
	        <h4>支付方式</h4>
	        <div class="zhifu">
	            <div class="zhifu1">
	                <input id="r1" type="radio" value="2" name="gender" checked="checked">
	                <img style=" margin-right: 50px;" class="img1" src="images/zhifubao.jpg" alt="">
	                <input id="r2" type="radio" value="1" name="gender">
	                <img class="img2" src="images/weixin.jpg" alt="">
	            </div>
	
	            <div class="but1">
	                <button type="submit" style="cursor: pointer;">立即付款</button>
	                <!-- <p>剩余付款时间：<span id="timeCounter">01 : 00 : 00</span></p> -->
	            </div>
	        </div>
        </form>
    </section>

    <!-- 底部 -->
    <section>
        <jsp:include page="bottom.jsp" />
        
        <style type="text/css">
		.dibu{
			background-color: #f3f3f3;
		}
	
		</style>
	
    </section>
    
    <script type="text/javascript">
    function stocknumcheck(oid){
    	var b=false;
    	$.ajax({
    		type:'POST',
    		url:'stocknumcheck',
    		data:{oid:oid},
    		dataType:'json',
    		async:false,
    		success:function(data){
    			if(data){
    				b=true;
    			}else{
    				layer.msg("库存不足，请重新下单",{icon: 2,time:2000});
    			}
    		},
    		error:function(data) {
                console.log(data.msg);
            },
    	});
    	return b;
    }
    
  	//去付款验证地址
	function yanz(){
		var fale = false;
		$.ajaxSettings.async = false;
		$.post("yanz",function(data){
			if(data){
				fale = true;
			}else{
				layer.msg("请先在个人中心填写地址！",{icon: 2,time:2000});
			}
		},"json");
		$.ajaxSettings.async = true;
		return fale;
	}
    </script>
    
</body>

</html>